<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div id="app">
        <!-- 配置路径 -->
        <router-link to="/home">主页</router-link>
        <router-link to="/top">热点</router-link>
        <router-link to="/about">关于我们</router-link>
        <!-- 显示的内容 -->
        <router-view></router-view>
    </div>
    <script src="./vue.js"></script>
    <script src="./vue-router.js"></script>
    <script>
        // 模板内容
        let Home = {
            template: `<div><span>主页</span></div>`
        }
        let Top = {
            template: `<div><span>热点</span></div>`
        }
        let About = {
            template: `<div><span>关于我们</span></div>`
        }
        // 匹配规则
        let router = new VueRouter({
            routes: [{
                path: '/home',
                component: Home
            },{
                path: '/top',
                component: Top
            },{
                path: '/about',
                component: About
            }]
        })
        let vm = new Vue({
            el: '#app',
            data: {},
            router
        })
    </script>
</body>
</html>